package com.kh.tool.mapvalidator;


import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

import java.util.Map;

public abstract class AbstractMapRequestValidator implements Validator {
    @Override
    public final boolean supports(Class<?> clazz) {
        return Map.class.equals(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
        CustomMapBindingResult customMapBindingResult = (CustomMapBindingResult) errors;
        validate(target,customMapBindingResult,errors);
    }

    public abstract void validate(Object target, CustomMapBindingResult customMapBindingResult, Errors errors);
}
